﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySpace.Data;
/// <summary>
///NewsTable 的摘要说明
/// </summary>
namespace DataBaseTable
{
    public class DengXinTable:DBTable
    {
        private const string tableName = "DengXinArticle";
        public DengXinTable()
            : base(GetHandler.Init(), tableName)
        {
            this.GetRow();
            //没有参数重载
        }
        public DengXinTable(int Newid)
            : base(GetHandler.Init(), tableName)
        {
            this.Filter = "id=?";
            this.AddParameter("id", Newid);
            this.GetRow();
            //没有参数重载
        }

        /// <summary>
        /// ID
        /// </summary>
        public int ID
        {
            get
            {
                try { return (int)this.DataRow["id"]; }
                catch { return 0; }
            }
        }
        /// <summary>
        /// 所属期数
        /// </summary>
        public int PeriodsId
        {
            get
            {
                try { return (int)this.DataRow["PeriodsId"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["PeriodsId"] = value;
            }
        }
        /// <summary>
        /// 章节ID
        /// </summary>
        public int ChapterId
        {
            get
            {
                try { return (int)this.DataRow["ChapterId"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["ChapterId"] = value;
            }
        }
        
        /// <summary>
        /// 置顶
        /// </summary>
        public int IsTop
        {
            get
            {
                try { return (int)this.DataRow["IsTop"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["IsTop"] = value;
            }
        }
        /// <summary>
        /// 新闻标题
        /// </summary>
        public string NewTitle
        {
            get
            {
                try { return (string)this.DataRow["NewTitle"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["NewTitle"] = value;
            }
        }        
        /// <summary>
        /// 外部URL
        /// </summary>
        public string OutUrl
        {
            get
            {
                try { return (string)this.DataRow["OutUrl"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["OutUrl"] = value;
            }
        }
        /// <summary>
        /// 内容
        /// </summary>
        public string Contents
        {
            get
            {
                try { return (string)this.DataRow["Contents"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["Contents"] = value;
            }
        }        
        /// <summary>
        /// 作者
        /// </summary>
        public string Author
        {
            get
            {
                try { return (string)this.DataRow["Author"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["Author"] = value;
            }
        }
        /// <summary>
        /// 文章添加时间
        /// </summary>
        public DateTime AddTime
        {
            get
            {
                try { return (DateTime)this.DataRow["AddTime"]; }
                catch { return DateTime.Now; }
            }
        }
        /// <summary>
        /// 审核
        /// </summary>
        public int Shenhe
        {
            get
            {
                try { return (int)this.DataRow["Shenhe"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["Shenhe"] = value;
            }
        }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort
        {
            get
            {
                try { return (int)this.DataRow["Sort"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["Sort"] = value;
            }
        }
        /// <summary>
        /// 浏览次数
        /// </summary>
        public int hits
        {
            get
            {
                try { return (int)this.DataRow["hits"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["hits"] = value;
            }
        }
        
    }
    public class DengXinCatalogueTable : DBTable
    {
        private const string tableName = "DengXinCatalogue";
        public DengXinCatalogueTable()
            : base(GetHandler.Init(), tableName)
        {
            this.GetRow();
            //没有参数重载
        }
        public DengXinCatalogueTable(int CatalogueId)
            : base(GetHandler.Init(), tableName)
        {
            this.Filter = "CatalogueId=?";
            this.AddParameter("CatalogueId", CatalogueId);
            this.GetRow();
            //没有参数重载
        }
        /// <summary>
        /// CatalogueId
        /// </summary>
        public int CatalogueId
        {
            get
            {
                try { return (int)this.DataRow["CatalogueId"]; }
                catch { return 0; }
            }
        }
        /// <summary>
        /// 章节名称
        /// </summary>
        public string ChapterName
        {
            get
            {
                try { return (string)this.DataRow["ChapterName"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["ChapterName"] = value;
            }
        }
        /// <summary>
        /// 所属期数
        /// </summary>
        public int ForPeriodsId
        {
            get
            {
                try { return (int)this.DataRow["ForPeriodsId"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["ForPeriodsId"] = value;
            }
        }
        /// <summary>
        /// 所属大类名称(只读)
        /// </summary>
        public string ForPeriodsName
        {
            get
            {
                try { return (new DengXinBookTable(this.ForPeriodsId).PeriodsName); }
                catch { return string.Empty; }
            }
        } 
    }
    public class DengXinBookTable : DBTable
    {
        private const string tableName = "DengXinBook";
        public DengXinBookTable()
            : base(GetHandler.Init(), tableName)
        {
            this.GetRow();
            //没有参数重载
        }
        public DengXinBookTable(int BookId)
            : base(GetHandler.Init(), tableName)
        {
            this.Filter = "BookId=?";
            this.AddParameter("BookId", BookId);
            this.GetRow();
            //没有参数重载
        }
        /// <summary>
        /// BookId
        /// </summary>
        public int BookId
        {
            get
            {
                try { return (int)this.DataRow["BookId"]; }
                catch { return 0; }
            }
        }
        /// <summary>
        /// 期数名称
        /// </summary>
        public string PeriodsName
        {
            get
            {
                try { return (string)this.DataRow["PeriodsName"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["PeriodsName"] = value;
            }
        }
        /// <summary>
        /// 索引
        /// </summary>
        public int DIndex
        {
            get
            {
                try { return (int)this.DataRow["DIndex"]; }
                catch { return 0; }
            }
            set
            {
                this.DataRow["DIndex"] = value;
            }
        }
        /// <summary>
        /// 出版年份
        /// </summary>
        public string PublishYear
        {
            get
            {
                try { return (string)this.DataRow["PublishYear"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["PublishYear"] = value;
            }
        }
        /// <summary>
        /// 封面名称
        /// </summary>
        public string Cover
        {
            get
            {
                try { return (string)this.DataRow["Cover"]; }
                catch { return string.Empty; }
            }
            set
            {
                this.DataRow["Cover"] = value;
            }
        }

    }

}